package org.apache.flink.core.execution;

import java.util.Map;
import java.util.concurrent.CompletableFuture;

import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.ConsumerID;
import org.apache.flink.api.common.ConsumingStatus;
import org.apache.flink.api.common.ConsumingResult;

/**
 *  A client that is scoped to a specific 资源消费. 
 * 
 */
@PublicEvolving
public interface JobClient {

    /** Returns the {@link ConsumerID} that uniquely identifies the consuming this client is scoped to. */
    ConsumerID getConsumerID();

    /** Requests the {@link ConsumingStatus} of the associated job. */
    CompletableFuture<ConsumingStatus> getConsumingStatus();
    
    /** Returns the {@link ConsumingResult result of the job execution} of the submitted job. */
    CompletableFuture<ConsumingResult> getConsumingResult();

    /** Cancels the associated job. */
    CompletableFuture<Void> cancel();

    /**
     * Requests the accumulators of the associated job. 
     * Accumulators can be requested while it is running or after it has finished. 
     * The class loader is used to deserialize the incoming accumulator results.
     */
    CompletableFuture<Map<String, Object>> getAccumulators();

}
